<?php


namespace app\api\model\user;


use think\Model;

class UserMoneyRecord extends Model
{
    protected $name = 'user_money_record';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';

    public function getTypeAttr($value)
    {
        $type = ['income'=>'收入','expend'=>'支出'];
        return $type[$value];
    }
    public function getRecordTypeAttr($value)
    {
        $type = ['system'=>'系统奖励金','manage'=>'管理奖励金','consume bonus'=>'消费分红','extract'=>'提现','transfer'=>'转账','consume'=>'消费'];
        return $type[$value];
    }
    public function getPayTypeAttr($value)
    {
        $type = [''=>null,'balance'=>'账户余额','alipay'=>'支付宝','wxpay'=>'微信支付','bank'=>'银行卡支付'];
        return $type[$value];
    }

    public function business()
    {
        return $this->belongsTo('Business', 'business_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}